/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.irssproject.app.entitats;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author adria
 */
@Entity
@Table(name = "etiquetes")
@NamedQueries({
    @NamedQuery(name = "Label.findAll", query = "SELECT e FROM Label e")})
public class Label implements Serializable {
    private static final long serialVersionUID = 1L;

    private Long id;
    private String nom;

    public Label() {
    }

    public Label(Long idetiqueta) {
        this.id = idetiqueta;
    }

    public Label(Long idetiqueta, String valor) {
        this.id = idetiqueta;
        this.nom = valor;
    }

    public Label(String valor) {
        this.nom = valor;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idetiqueta")
    public Long getId() {
        return id;
    }

    public void setId(Long idetiqueta) {
        this.id = idetiqueta;
    }

    @Basic(optional = false)
    @Column(name = "valor")
    public String getNom() {
        return nom;
    }

    public void setNom(String valor) {
        this.nom = valor;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Label)) {
            return false;
        }
        Label other = (Label) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.irssproject.app.entitats.Etiqueta[idetiqueta=" + id + "]";
    }

}
